package com.lihui.test;

import com.lihui.binarytree.BinaryTree;

import javax.swing.tree.TreeNode;
import java.util.ArrayList;
import java.util.List;

/**
 * 功能描述
 *
 * @author wileda
 * @date 2022/10/22  16:03
 */
public class Demo01 {
    public static void main(String[] args) {
        List<Integer> list = new ArrayList<>();
        BinaryTree binaryTree = new BinaryTree();
        binaryTree.create();
        System.out.println();
        // 前序遍历
        binaryTree.preOrder(binaryTree.root);
        System.out.println();
        //中序遍历
        binaryTree.inOrder(binaryTree.root);
        System.out.println();
        //后续遍历
        binaryTree.postOrder(binaryTree.root);
        System.out.println();

        System.out.println(binaryTree.size(binaryTree.root));

        System.out.println(binaryTree.getLeafNodeCount1(binaryTree.root));
        System.out.println(binaryTree.getKLevelNodeCount(binaryTree.root, 4));
        System.out.println("=======================");
        System.out.println(binaryTree.getHeight(binaryTree.root));
        System.out.println("====================================");

        System.out.println(binaryTree.find(binaryTree.root, 2));
        System.out.println("==============================");

        binaryTree.levelOrder(binaryTree.root);
        System.out.println();
        System.out.println(binaryTree.isCompleteTree(binaryTree.root));

    }
}
